package AbstractFactoryMethodPattern.example;

import AbstractFactoryMethodPattern.example.framework.*;

public class Microsoft extends Factory {
    @Override
    public Product createCPU(String type) {
        Product p = null;
        switch (type) {
            case "i7":
                p = new CPU("Intel i7 9700K");
                break;
            case "i9":
                p = new CPU("Intel i9 9700K");
                break;
            default:
                break;
        }
        return p;
    }

    @Override
    public Product createRAM(String type) {
        Product p = null;
        switch (type) {
            case "8G":
                p = new RAM("Sam 8G");
                break;
            case "16G":
                p = new RAM("Sam 16G");
                break;
            default:
                break;
        }
        return p;
    }

    @Override
    public Product createPhone(String type) {
        Product p = null;
        CPU cpu;
        RAM ram;
        switch (type) {
            case "LumiaX":
                cpu = (CPU) createCPU("i7");
                ram = (RAM) createRAM("8G");
                p = new Phone("LumiaX", cpu, ram);
                break;
            case "LumiaXS":
                cpu = (CPU) createCPU("i79");
                ram = (RAM) createRAM("16G");
                p = new Phone("LumiaXS", cpu, ram);
                break;
            default:
                break;
        }
        return p;
    }

    @Override
    public Product createComputer(String type) {
        Product p = null;
        CPU cpu;
        RAM ram;
        switch (type) {
            case "SurfaceGo":
                cpu = (CPU) createCPU("i7");
                ram = (RAM) createRAM("8G");
                p = new Computer("Surface Go 2016", cpu, ram);
                break;
            case "SurfacePro":
                cpu = (CPU) createCPU("i9");
                ram = (RAM) createRAM("16G");
                p = new Computer("Surface Pro 2016", cpu, ram);
                break;
            default:
                break;
        }
        return p;
    }
}
